package com.example.film.controller;

import com.example.film.entity.FilmWeekSell;
import com.example.film.service.FilmWeekSellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "影片每周票房信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("filmWeek/v1")
public class FilmWeekSellController {
    @Autowired
    private FilmWeekSellService filmWeekSellService;

    @ApiOperation("影片影院票房信息")
    @GetMapping("/filmSell")
    public List<FilmWeekSell> getFilmWeekSell(){
        return filmWeekSellService.findFilmWeekSell();
    }

    @ApiOperation("分页查询影片影院票房信息")
    @GetMapping("/film")
    public List<FilmWeekSell> getFilmWeekSell(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return filmWeekSellService.findFilmWeekSellInfo(pageNum, pageSize);
    }

    @ApiOperation("根据周数查询影片影院票房信息")
    @GetMapping("/week/{week}")
    public List<FilmWeekSell> getFilmWeekSellByWeek(@PathVariable Integer week){
        return filmWeekSellService.findFilmWeekSellByWeek(week);
    }
}